

//--------------------------------------------------------------------------------------
// entrancepoint: You can safely register as many $(document).ready() event handlers as you want.  Later ones won't supersede earlier ones. 
// They'll execute in the order that they were registered (generally the order that they appear on the page).
$(document).ready( function() 
{   
    if( typeof(fillAssetToKillPickListRequest) != "undefined"  )
    {
        fillAssetToKillPickListRequest(false,"");
    }
    if( typeof(fillMarketAssetListAndDescriptionRequest) != "undefined" )
    {
        fillMarketAssetListAndDescriptionRequest();
    }
});

//--------------------------------------------------------------------------------------
// when the document is fully loaded
$(window).load( function() 
{   
    if( typeof(create_chat_box) != 'undefined' )
    {
        setTimeout('create_chat_box()',1000);
    }
});

//--------------------------------------------------------------------------------------
// the next global variable and the next function are linked to the answering time of the chat login.
// we try here to abort the login to leave the page earlier, but this is not really working
// the chatConnectionRequest variable is initialised in chatLayout.js
// THIS IS REALLY DIRTY and not really working
chatConnectionRequest = null;// variable for the long chat connection request
function leavPageToURLWithoutWaiting( next_url )
{
    //abort
    if( chatConnectionRequest != null )
    {   
        try
        {
            chatConnectionRequest.abort();
            chatConnectionRequest = null;
        }
        catch( e )
        {
            // we try to clean the chat frame in case it exists
            try
            {
                $('#notifications').empty();
                $('#id_Notifications').text( 'Leaving page' );
            }
            catch( e )
            {
                //do nothing   
            }
        }
    }
   // go to the page
   window.location = next_url;
};